package com.gdl.web.test.demo.config;

import com.baomidou.mybatisplus.extension.plugins.OptimisticLockerInterceptor;
import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

//这里都是基于mybatis plus 的配置
@Configuration
//全局扫描秒mapper包路径
@MapperScan("com.gdl.web.test.demo.mapper")
public class MybatisPlusConfig {

    //    乐观锁插件 会对 vo中的@version 注解数据进行特别操作
    @Bean
    public OptimisticLockerInterceptor optimisticLockerInterceptor() {
        return new OptimisticLockerInterceptor();
    }

    //分页插件
    @Bean
    public PaginationInterceptor paginationInterceptor() {
        return new PaginationInterceptor();
    }
}
